/************************************************
 *** Datei: Keyboard.h
 ***
 *** Erstellt am: 29.05.2012
 ***       Autor: Max Stark <Max.Stark88@googlemail.com>
 ***	 Version: 1.0
 ***
 *** Beschreibung:
 *** <hier Beschreibung einfuegen>
 ************************************************/

#ifndef KEYBOARD_H_
#define KEYBOARD_H_


#include <string>
using namespace std;
#include <model/IDroneController.h>

#include <conio.h>
#include<windows.h>
#include <stdio.h>

#define KEYBOARD_COMMAND_BUILD_INTERVAL 	100
#define KEYBOARD_COMMAND_REFRESH_INTERVAL   20

#define MOVE_0  0.0
#define MOVE_P	0.05
#define MOVE_N	-0.05

#include <boost/thread.hpp>
using namespace boost;

class Keyboard: public IDroneController {
private:
	float roll, pitch, yaw, up;
	bool isFlying, specialCommand, emergency;
	bool running;

	DroneCommand* lastDroneCommand;
	DroneCommand* nextDroneCommand;

	void makeNewCommand();

	thread* buildCommandsThread;
	bool 	buildCommandsThread_Active;
	void 	buildCommands();

public:
	Keyboard();
	virtual ~Keyboard();

	void run();
	DroneCommand* getNextDroneCommand();
	string getDeviceName();
};

#endif /* KEYBOARD_H_ */
